<?php
(!defined('IN_TOA') || !defined('IN_ADMIN')) && exit('Access Denied!');
/*
	[天生创想] (C)2008-2011 515158 Inc.
	This is NOT a freeware, use is subject to license terms
    URL:http://www.515158.com/
*/


get_config_keytable("istration_conference_Increase");

empty($do) && $do = 'list';
if ($do == 'list') {
	include_once('template/add.php');

} elseif ($do == 'save') {
	
	$savetype = getGP('savetype','P');
	$title = getGP('title','P');
	$subject = getGP('subject','P');
	$content = getGP('content','P');
	$appperson = getGP('apppersonid','P');
	$date = get_date('Y-m-d h:i:s',PHP_TIME);
	$attendance = getGP('participation','P');
	$startdate = getGP('startdate','P')." ".getGP('starttime1','P').":".getGP('starttime2','P');
	$enddate = getGP('enddate','P')." ".getGP('endtime1','P').":".getGP('endtime2','P');
	$conferenceroom = getGP('conferenceroom','P');
	$type = 1;
	$otype = getGP('otype','P');
	$staffid = getGP('staffidid','P');
	$uid=$_USER->id;
	//////////////
	$apppersonsms=getGP('appperson','P');
	$staffidsms=getGP('staffid','P');
	
	//主表信息
	$conference = array(
		'title' => $title,
		'subject' => $subject,
		'content' => $content,
		'appperson' => $appperson,
		'date' => $date,
		'attendance' => $attendance,
		'startdate' => $startdate,
		'enddate' => $enddate,
		'conferenceroom' => $conferenceroom,
		'type' => $type,
		'staffid' => $staffid,
		'uid' => $uid,
		'otype' => $otype
	);
	//写入主表信息
	insert_db('conference',$conference);
	$id=$db->insert_id();
	//申请人
	if(getGP('sms_info_box_appperson','P')!=''){
	$content=$apppersonsms.':您申请的会议室己经提交,请注意查看!<a href="admin.php?ac=edit&fileurl=conference&do=edit&id='.$id.'&type=&ukeys=1">点击查看>></a>';
	
	SMS_ADD_POST($apppersonsms,$content,0,0,$_USER->id);
	}
	if(getGP('sms_phone_box_appperson','P')!=''){
	$content=$apppersonsms.':您申请的会议室己经提交,请登录OA进行查看!';
	PHONE_ADD_POST(getGP('apppersonphone','P'),$content,$apppersonsms,0,0,$_USER->id);
	}
	//出席人员
	if(getGP('sms_info_box_participation','P')!=''){
	$content=$attendance.':您有一个会议需要出席,请注意查看会议出席时间!<a href="admin.php?ac=edit&fileurl=conference&do=edit&id='.$id.'&type=&ukeys=1">点击查看>></a>';
	
	SMS_ADD_POST($attendance,$content,0,0,$_USER->id);
	}
	
	if(getGP('sms_phone_box_participation','P')!=''){
	$content=$attendance.':您有一个会议需要出席,请登录OA进行查看!';
	PHONE_ADD_POST(getGP('participationphone','P'),$content,$attendance,0,0,$_USER->id);
	}
	//审批人员
	if(getGP('sms_info_box_staffid','P')!=''){
	$content=$staffidsms.':有一个会议申请需要您审批,请进入审批流程进行审批!<a href="admin.php?ac=key&fileurl=conference&do=edit&id='.$id.'&type=&ukeys=1">点击审批>></a>';
	
	SMS_ADD_POST($staffidsms,$content,0,0,$_USER->id);
	}
	
	if(getGP('sms_phone_box_staffid','P')!=''){
	$content=$staffidsms.':有一个会议申请需要您审批,请登录OA进行审批!';
	PHONE_ADD_POST(getGP('staffidphone','P'),$content,$staffidsms,0,0,$_USER->id);
	}
	
	$content=$title.get_inc_log(1).$subject.get_inc_log(1).$content.get_inc_log(1).$appperson.get_inc_log(1).$attendance.get_inc_log(1).$startdate.get_inc_log(1).$enddate.get_inc_log(1).$conferenceroom.get_inc_log(1).$type.get_inc_log(1).$staffid;
	$title='新增会议信息';
	get_oa_log_dbadd($id,$content,$title,19,$_USER->id);
    goto_page('admin.php?ac=index&fileurl=conference');

}
?>